# Maintainer: Bastien Dejean <nihilhill@gmail.com>

_pkgname=youtube-dl
pkgname=${_pkgname}-git
pkgver=9128
pkgrel=1
pkgdesc='A small command-line program to download videos from YouTube.com and a few more sites'
arch=('any')
url="http://rg3.github.com/${_pkgname}"
license=('custom')
depends=('python' 'python-setuptools')
makedepends=('git')
optdepends=('ffmpeg: for video post-processing')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("git+https://github.com/rg3/${_pkgname}.git")
md5sums=('SKIP')

pkgver() {
	cd "$_pkgname"
	git rev-list --count HEAD
}

prepare() {
	cd "$_pkgname"
	sed -i 's:etc/bash_completion.d:share/bash-completion/completions:' setup.py
}

package() {
	cd "$_pkgname"
	python devscripts/bash-completion.py
	python setup.py install --root="${pkgdir}/" --optimize=1
	mv "${pkgdir}/usr/share/bash-completion/completions/youtube-dl.bash-completion" \
	   "${pkgdir}/usr/share/bash-completion/completions/youtube-dl"
	install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
